<?php
include_once '../tools/DbTools.php';
if(empty($_COOKIE)){
    echo '未登录<br/>';
    echo '<a href="AdminiUi.php">去登陆</a>';die;
}
$IDCard = $_POST['IDCard'];
$OpenUser = $_POST['OpenUser'];
DbTools::InitDb();
$sql = "select * from accountinfo where AccountCode='$IDCard'";
$result = DbTools::select($sql);
DbTools::close();
if(!empty($result)){
    $aid=$result[0]['AccountId'];
    $bankid = '622509'.rand(1000000,9999999);
    DbTools::InitDb();
    $sql = "insert into bankcard(CardNo,AccountId,CardPwd,CardMoney,CardState,CardTime) 
        values('$bankid','$aid','123456','0.0000','0',NOW())";
    $result = DbTools::noSelect($sql);
    DbTools::close();
    if(empty($result)){
        echo '失败';
        die;
    }else{
        echo '成功';
        echo '<a href="AdminiAction.php">返回系统</a>';
    }
}else{
    echo '<a href="AdminiAction.php">返回系统</a>';
    echo '失败';
    die;
}